/**
 * 创元汇 - WebName
 * https://menger.me
 * @大梦
 */

import React, {Component} from 'react'
import {
    Text,
    View,
    Image,
    TextInput,
    ScrollView,
    StyleSheet,
    TouchableOpacity,
    StatusBar,
    WebView,
    Platform
} from 'react-native'
import NetRequest from '../../utils/utilsRequest'
import ServicesApi from '../../constants/ServicesApi'
import GlobalStyles from '../../constants/GlobalStyles'
import NavigationBar from '../../components/common/NavigationBar'
import UtilsView from '../../utils/utilsView'
import { toastShort, toastLong, consoleLog } from '../../utils/utilsToast'
import DateTimePicker from 'react-native-modal-datetime-picker';
import moment from 'moment';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'
import {Overlay, Label, Button} from 'teaset';
import AlertManager from '../../components/common/AlertManager'

export default class WebName extends Component {

    constructor(props) {
        super(props);
        const { params } = this.props.navigation.state;
        this.state =  {
            style: 0,
            reason: 0,
            surname: '',
            name: '',
            birthday: '',
            address: '',
            address_pinyin: '',
            birthaddress: '',
            birthaddress_pinyin: '',
            recognition: '',
            reason_describe: '',
            isDateTimePickerVisible: false,
            fund_id: params.fund_id,
            is_first: params.is_first,
            fene: params.fene,
            money:  params.money,
            rate_money: params.rate_money,
            total_money: params.total_money,
            fund_id: params.fund_id,
            fundDetailBankTitle: params.fundDetailBankTitle,
            fundDetailBankName: params.fundDetailBankName,
            fundDetailBankNum: params.fundDetailBankNum,
            open_day: params.open_day,
        }
        // this.netRequest = new NetRequest();
    }

    componentDidMount(){
        this.loadNetData();
    }

    onBack = () => {
        this.props.navigation.goBack();
    }

    updateState= (state) => {
        if (!this) { return };
        this.setState(state);
    }

    loadNetData = () => {
        
    }

    setStyle = (num) => {
        this.updateState({
            style: num
        })
    }

    setReason = (num) => {
        this.updateState({
            reason: num
        })
    }

    _showDateTimePicker = () => {
        this.setState({ 
            isDateTimePickerVisible: true 
        })
    }

    _hideDateTimePicker = () => {
        this.setState({ 
            isDateTimePickerVisible: false 
        });
    }

    _handleDatePicked = (date) => {
        let DateFormat =  moment(date).format("YYYY-MM-DD");
        this.setState({
            birthday: DateFormat
        });
        console.log(DateFormat);
        this.birthTimesCompleted(DateFormat);
        this._hideDateTimePicker();
    };

    birthTimesCompleted = (DateFormat) => {
        this.setState({
            birthday: DateFormat
        })
    }

    pushToSuccess = (compent, order_id) => {
        const { navigate } = this.props.navigation;
        navigate( compent , {
            fene: this.state.fene,
            money:  this.state.money,
            rate_money: this.state.rate_money,
            total_money: this.state.total_money,
            order_id: order_id,
            fund_id: this.state.fund_id,
            fundDetailBankTitle: this.state.fundDetailBankTitle,
            fundDetailBankName: this.state.fundDetailBankName,
            fundDetailBankNum: this.state.fundDetailBankNum,
            open_day: this.state.open_day,
        })
    }

    Subziliao = () => {
        let url = ServicesApi.tax_revenue_insert;
        let {style, reason, surname, name, birthday, address, address_pinyin, birthaddress, birthaddress_pinyin, recognition, reason_describe } = this.state;
        
        if(!style){
            toastShort('信息填写不完整'); return false;
        }else if(style == 2 || style == 3){
            if(!reason || !surname || !name || !birthday || !address || !address_pinyin || !birthaddress || !birthaddress_pinyin || !recognition){
                toastShort('信息填写不完整'); return false;
            }
            if(reason == 2 && !reason_describe){
                toastShort('信息填写不完整'); return false;
            }
        }
        
        let data = {
            style: this.state.style,
            reason: this.state.reason,
            surname: this.state.surname,
            name: this.state.name,
            birthday: this.state.birthday,
            address: this.state.address,
            address_pinyin: this.state.address_pinyin,
            birthaddress: this.state.birthaddress,
            birthaddress_pinyin: this.state.birthaddress_pinyin,
            recognition: this.state.recognition,
            reason_describe: this.state.reason_describe,
            member_id: global.user.userData.id,
            token: global.user.userData.token,
        }
        Services.post(url, data, true)
            .then( result => {
                console.log(result);
                if(result && result.code == StatusCode.SUCCESS_CODE){
                    toastShort(result.msg);
                    this.Shuishouzhengming(result.data.url, result.data.show_url);
                    
                }else{
                    toastLong(result.msg);
                }
            })
            .catch( error => {
                // toastShort('服务器请求失败，请稍后重试！');
            })
    }


    Shuishouzhengming = (ourl, show_link) => {
        let overlayView1 = (
            <Overlay.PullView side='bottom' modal={false} ref={v => this.overlayView1 = v}>
                <View style={{backgroundColor: '#fff', width: GlobalStyles.width, height: GlobalStyles.height}}>
                    <WebView
                        startInLoadingState={true}
                        source={{uri: show_link}}
                        style={styles.webContainer}
                    />
                    
                    <View style={styles.botBar}>
                        <TouchableOpacity onPress={()=>{this.overlayView1 && this.overlayView1.close()}} style={[styles.botLeft, GlobalStyles.hide]}>
                            <Text style={[styles.botLeftText, {fontSize: 15}]}>取消</Text>
                        </TouchableOpacity>
                        <TouchableOpacity onPress={()=>{this.submit008(ourl);}} style={styles.botRight}>
                            <Text style={styles.botRightText}>同意签署并进行下一步</Text>
                        </TouchableOpacity> 
                    </View>
                </View>
            </Overlay.PullView>
        );
        Overlay.show(overlayView1);
    }

    submit008 = (ourl) => {
        let url = ServicesApi.create_pdf;
        let data = {
            url: ourl,
            style: '008',
            member_id: global.user.userData.id,
            token: global.user.userData.token,
        }
        AlertManager.showPopView(<View style={[GlobalStyles.loadingview, GlobalStyles.flexColumnCenter]}><Image source={require('../../assets/images/icons/loading.gif')} style={GlobalStyles.loading} /><Text style={GlobalStyles.loadingtext}>文件生成中，请稍候...</Text></View>, { modal:true })
        Services.post(url, data, true)
            .then( result => {
                console.log(result);
                AlertManager.hide();
                if (result && result.code == StatusCode.SUCCESS_CODE) {
                    this.overlayView1 && this.overlayView1.close();
                    let url = ServicesApi.apply_buy_fund;
                    let data = {
                        fund_id: this.state.fund_id,
                        money: this.state.fene,
                        is_first: this.state.is_first,
                        member_id: global.user.userData.id,
                        token: global.user.userData.token,
                    };
                    Services.post(url, data, true)
                        .then( result => {
                            console.log(result);
                            if (result && result.code == StatusCode.SUCCESS_CODE) {
                                if(result.data.style == '006'){
                                    this.Hetongwenben6(result.data.id, result.data.url, result.data.show_url)
                                }else if(result.data.style == '007'){
                                    this.Hetongwenben7(result.data.id, result.data.url, result.data.show_url)
                                }
                            }else{
                                toastLong(result.msg);
                            }
                        })
                        .catch( error => {
                            toastShort('服务器请求失败，请稍后重试！');
                        })
                }else{
                    toastLong(result.msg);
                }
            })
            .catch( error => {
                // toastShort('服务器请求失败，请稍后重试！');
            })
    }


    Hetongwenben6 = (oid, ourl, show_link) => {
        toastShort('因托管人系统权限问题，其基金合同签章需线下加盖，特此提示。', 3000)
        let overlayView3 = (
            <Overlay.PullView side='bottom' modal={false} ref={v => this.overlayView3 = v}>
                <View style={{backgroundColor: '#fff', width: GlobalStyles.width, height: GlobalStyles.height}}>
                    <WebView
                        ref={(webView) => {this.webview = webView}}
                        startInLoadingState={true}
                        source={{uri: show_link}}
                        style={styles.webContainer}
                    />

                    <View style={styles.hetongico}>
                        <TouchableOpacity onPress={()=>{this.fanhuidingbu()}} style={styles.fanhuidingbu}>
                            <Image source={require('../../assets/images/icons/fanhuidingbu.png')} style={styles.fanhuidingbuico} />
                        </TouchableOpacity>
                        <TouchableOpacity onPress={()=>{this.yijiandaodi()}} style={styles.yijiandaodi}>
                            <Image source={require('../../assets/images/icons/yijiandaodi.png')} style={styles.yijiandaodiico} />
                        </TouchableOpacity>
                    </View>
                    
                    <View style={styles.botBar}>
                        <TouchableOpacity onPress={()=>{this.overlayView3 && this.overlayView3.close()}} style={[styles.botLeft, GlobalStyles.hide]}>
                            <Text style={[styles.botLeftText, {fontSize: 15}]}>取消</Text>
                        </TouchableOpacity>
                        <TouchableOpacity onPress={()=>{this.submit006(oid, ourl);}} style={styles.botRight}>
                            <Text style={styles.botRightText}>同意并提交</Text>
                        </TouchableOpacity> 
                    </View>
                </View>
            </Overlay.PullView>
        );
        Overlay.show(overlayView3);
    }

    fanhuidingbu = () => {
        let message = 'fanhuidingbu'
        this.webview.postMessage(message);
    }

    yijiandaodi = () => {
        let message = 'yijiandaodi'
        this.webview.postMessage(message);
    }


    Hetongwenben7 = (oid, ourl, show_link) => {
        toastShort('因托管人系统权限问题，其基金合同签章需线下加盖，特此提示。', 3000)
        let overlayView3 = (
            <Overlay.PullView side='bottom' modal={false} ref={v => this.overlayView3 = v}>
                <View style={{backgroundColor: '#fff', width: GlobalStyles.width, height: GlobalStyles.height}}>
                    <WebView
                        ref={(webView) => {this.webview = webView}}
                        startInLoadingState={true}
                        source={{uri: show_link}}
                        style={styles.webContainer}
                    />

                    <View style={[styles.hetongico, GlobalStyles.hide]}>
                        <TouchableOpacity onPress={()=>{this.fanhuidingbu()}} style={styles.fanhuidingbu}>
                            <Image source={require('../../assets/images/icons/fanhuidingbu.png')} style={styles.fanhuidingbuico} />
                        </TouchableOpacity>
                        <TouchableOpacity onPress={()=>{this.yijiandaodi()}} style={styles.yijiandaodi}>
                            <Image source={require('../../assets/images/icons/yijiandaodi.png')} style={styles.yijiandaodiico} />
                        </TouchableOpacity>
                    </View>
                    
                    <View style={styles.botBar}>
                        <TouchableOpacity onPress={()=>{this.overlayView3 && this.overlayView3.close()}} style={[styles.botLeft, GlobalStyles.hide]}>
                            <Text style={[styles.botLeftText, {fontSize: 15}]}>取消</Text>
                        </TouchableOpacity>
                        <TouchableOpacity onPress={()=>{this.submit007(oid, ourl);}} style={styles.botRight}>
                            <Text style={styles.botRightText}>同意并提交</Text>
                        </TouchableOpacity> 
                    </View>
                </View>
            </Overlay.PullView>
        );
        Overlay.show(overlayView3);
    }

    submit006 = (oid, ourl) => {
        let url = ServicesApi.create_pdf;
        let data = {
            url: ourl,
            style: '006',
            order_id: oid,
            member_id: global.user.userData.id,
            token: global.user.userData.token,
        }
        AlertManager.showPopView(<View style={[GlobalStyles.loadingview, GlobalStyles.flexColumnCenter]}><Image source={require('../../assets/images/icons/loading.gif')} style={GlobalStyles.loading} /><Text style={GlobalStyles.loadingtext}>文件生成中，请稍候...</Text></View>, { modal:true })
        Services.post(url, data, true)
        .then( result => {
            console.log(result);
            AlertManager.hide();
            if (result && result.code == StatusCode.SUCCESS_CODE) {
                this.overlayView3 && this.overlayView3.close();
                this.pushToSuccess('Tijiaochenggong', oid);
            }else{
                toastLong(result.msg);
            }
        })
        .catch( error => {
            // toastShort('服务器请求失败，请稍后重试！');
        })
    }

    submit007 = (oid, ourl) => {
        let url = ServicesApi.create_pdf;
        let data = {
            url: ourl,
            style: '007',
            order_id: oid,
            member_id: global.user.userData.id,
            token: global.user.userData.token,
        }
        AlertManager.showPopView(<View style={[GlobalStyles.loadingview, GlobalStyles.flexColumnCenter]}><Image source={require('../../assets/images/icons/loading.gif')} style={GlobalStyles.loading} /><Text style={GlobalStyles.loadingtext}>文件生成中，请稍候...</Text></View>, { modal:true })
        Services.post(url, data, true)
        .then( result => {
            console.log(result);
            AlertManager.hide();
            if (result && result.code == StatusCode.SUCCESS_CODE) {
                this.overlayView3 && this.overlayView3.close();
                this.pushToSuccess('Tijiaochenggong', oid);
            }else{
                toastLong(result.msg);
            }
        })
        .catch( error => {
            // toastShort('服务器请求失败，请稍后重试！');
        })
    }

    onPushNavigator = (compent) => {
        const { navigate } = this.props.navigation;
        navigate( compent , {
            onCallBack:()=>{
                console.log('1');
            }
        })
    }
    

    render(){
        let navigationBar = {
            backgroundColor: '#fff',
            borderBottomColor: '#f2f2f2',
            borderBottomWidth: 1
        }
        return (
            <View style={styles.container}>
                <NavigationBar
                    title = {'个人税收居民身份声明文件'}
                    style = {navigationBar}
                    titleStyle = {{color: '#333333'}}
                    leftButton = {UtilsView.getLeftBlackButton(() => this.onBack())}
                    rightButton = {UtilsView.getRightKefuBlackButton(() => this.onPushNavigator('Kefu'))}
                />
                <StatusBar
                    animated = {true}
                    hidden = {false}
                    backgroundColor = {'transparent'}
                    translucent = {true}
                    barStyle = {'dark-content'}
                />
                <KeyboardAwareScrollView keyboardShouldPersistTaps={'handled'}>
                    <View style={[GlobalStyles.whiteModule, {marginTop: 10}]}>
                        <View style={[GlobalStyles.titleModule,GlobalStyles.flexRowBetween]}>
                            <View style={[GlobalStyles.titleLeft, GlobalStyles.flexRowStartStart]}>
                                <Text style={GlobalStyles.titleText}>本人声明<Text style={{fontSize: 13, color: '#666', fontWeight: 'normal'}}>（带<Text style={{color: GlobalStyles.themeColor}}>*</Text>号的为必填项）</Text></Text>
                            </View>
                        </View>
                        <View style={[GlobalStyles.mradio, {width: GlobalStyles.width - 30}]}>
                            {this.state.style == '1' ?
                                <TouchableOpacity onPress={() => {this.setStyle(1)}} style={[GlobalStyles.radioItem, GlobalStyles.flexRowStartStart]}>
                                    <View style={[GlobalStyles.radioLeft, {borderColor: GlobalStyles.themeColor, backgroundColor: GlobalStyles.themeColor}]}>
                                        <Image source={require('../../assets/images/icons/icon_gouxuan.png')} style={[GlobalStyles.gouxuanIco]} />
                                    </View>
                                    <Text style={GlobalStyles.radioRightThemeColor}>仅为中国税收居民</Text>
                                </TouchableOpacity>
                            :
                                <TouchableOpacity onPress={() => {this.setStyle(1)}} style={[GlobalStyles.radioItem, GlobalStyles.flexRowStartStart]}>
                                    <View style={[GlobalStyles.radioLeft, {borderColor: '#666', }]}></View>
                                    <Text style={GlobalStyles.radioRight}>仅为中国税收居民</Text>
                                </TouchableOpacity>
                            }
                            {this.state.style == 2 ?
                                <TouchableOpacity onPress={() => {this.setStyle(2)}} style={[GlobalStyles.radioItem, GlobalStyles.flexRowStartStart]}>
                                    <View style={[GlobalStyles.radioLeft, {borderColor: GlobalStyles.themeColor, backgroundColor: GlobalStyles.themeColor}]}>
                                        <Image source={require('../../assets/images/icons/icon_gouxuan.png')} style={[GlobalStyles.gouxuanIco]} />
                                    </View>
                                    <Text style={GlobalStyles.radioRightThemeColor}>仅为非居民</Text>
                                </TouchableOpacity>
                            :
                                <TouchableOpacity onPress={() => {this.setStyle(2)}} style={[GlobalStyles.radioItem, GlobalStyles.flexRowStartStart]}>
                                    <View style={[GlobalStyles.radioLeft, {borderColor: '#666', }]}></View>
                                    <Text style={GlobalStyles.radioRight}>仅为非居民</Text>
                                </TouchableOpacity>
                            }
                            {this.state.style == 3 ?
                                <TouchableOpacity onPress={() => {this.setStyle(3)}} style={[GlobalStyles.radioItem, GlobalStyles.flexRowStartStart]}>
                                    <View style={[GlobalStyles.radioLeft, {borderColor: GlobalStyles.themeColor, backgroundColor: GlobalStyles.themeColor}]}>
                                        <Image source={require('../../assets/images/icons/icon_gouxuan.png')} style={[GlobalStyles.gouxuanIco]} />
                                    </View>
                                    <Text style={GlobalStyles.radioRightThemeColor}>既是中国税收居民又是其他国家(地区)税收居民</Text>
                                </TouchableOpacity>
                            :
                                <TouchableOpacity onPress={() => {this.setStyle(3)}} style={[GlobalStyles.radioItem, GlobalStyles.flexRowStartStart]}>
                                    <View style={[GlobalStyles.radioLeft, {borderColor: '#666', }]}></View>
                                    <Text style={GlobalStyles.radioRight}>既是中国税收居民又是其他国家(地区)税收居民</Text>
                                </TouchableOpacity>
                            }
                        </View>
                    </View>
                    
                    {this.state.style == 2 || this.state.style == 3 ?
                        <View>
                            <View style={[GlobalStyles.whiteModule, {marginTop: 10}]}>
                                <View style={[GlobalStyles.titleModule,GlobalStyles.flexRowBetween]}>
                                    <View style={[GlobalStyles.titleLeft, GlobalStyles.flexRowStartStart]}>
                                        <Text style={GlobalStyles.titleText}>个人信息<Text style={{fontSize: 13, color: '#666', fontWeight: 'normal'}}>（带<Text style={{color: GlobalStyles.themeColor}}>*</Text>号的为必填项）</Text></Text>
                                    </View>
                                </View>
                                <View style={GlobalStyles.mcell}>
                                    <View style={GlobalStyles.cellItem}>
                                        <Text style={GlobalStyles.cellLeft}>姓氏<Text style={{color: GlobalStyles.themeColor}}>*</Text></Text>
                                        <View style={GlobalStyles.cellRight}>
                                            <TextInput
                                                placeholder={this.state.surname ? this.state.surname : '姓氏(英文或拼音)' }
                                                onChangeText={(text) => {
                                                    this.updateState({surname: text})
                                                }}
                                                style={[GlobalStyles.cellInput, GlobalStyles.cellTextColor, GlobalStyles.isIOS ? null : styles.inputAndroid]} 
                                                underlineColorAndroid={'transparent'}
                                            >
                                            </TextInput>
                                        </View>
                                    </View>
                                    <View style={GlobalStyles.cellItem}>
                                        <Text style={GlobalStyles.cellLeft}>名字<Text style={{color: GlobalStyles.themeColor}}>*</Text></Text>
                                        <View style={GlobalStyles.cellRight}>
                                            <TextInput
                                                placeholder={this.state.name ? this.state.name : '名字(英文或拼音)' }
                                                onChangeText={(text) => {
                                                    this.updateState({name: text})
                                                }}
                                                style={[GlobalStyles.cellInput, GlobalStyles.cellTextColor, GlobalStyles.isIOS ? null : styles.inputAndroid]} 
                                                underlineColorAndroid={'transparent'}
                                            >
                                            </TextInput>
                                        </View>
                                    </View>
                                    <View style={GlobalStyles.cellItem}>
                                        <Text style={GlobalStyles.cellLeft}>出生日期<Text style={{color: GlobalStyles.themeColor}}>*</Text></Text>
                                        <TouchableOpacity onPress={() => {this._showDateTimePicker()}} style={[GlobalStyles.cellRight, GlobalStyles.flexRowStart]} >
                                            <Text style={styles.cellRightText}>{this.state.birthday ? this.state.birthday : '点击选择您的出生日期'}</Text>
                                        </TouchableOpacity>
                                    </View>
                                    <View style={GlobalStyles.cellItem}>
                                        <Text style={GlobalStyles.cellLeft}>现居地址</Text>
                                        <View style={GlobalStyles.cellRight}>
                                            <TextInput
                                                placeholder={this.state.address ? this.state.address : '现居地址(中文)，境外地址不填此项' }
                                                onChangeText={(text) => {
                                                    this.updateState({address: text})
                                                }}
                                                style={[GlobalStyles.cellInput, GlobalStyles.cellTextColor, GlobalStyles.isIOS ? null : styles.inputAndroid]} 
                                                underlineColorAndroid={'transparent'}
                                            >
                                            </TextInput>
                                        </View>
                                    </View>
                                    <View style={GlobalStyles.cellItem}>
                                        <Text style={GlobalStyles.cellLeft}>现居地址<Text style={{color: GlobalStyles.themeColor}}>*</Text></Text>
                                        <View style={GlobalStyles.cellRight}>
                                            <TextInput
                                                placeholder={this.state.address_pinyin ? this.state.address_pinyin : '现居地址(英文或拼音)' }
                                                onChangeText={(text) => {
                                                    this.updateState({address_pinyin: text})
                                                }}
                                                style={[GlobalStyles.cellInput, GlobalStyles.cellTextColor, GlobalStyles.isIOS ? null : styles.inputAndroid]} 
                                                underlineColorAndroid={'transparent'}
                                            >
                                            </TextInput>
                                        </View>
                                    </View>
                                    <View style={GlobalStyles.cellItem}>
                                        <Text style={GlobalStyles.cellLeft}>出生地<Text style={{color: GlobalStyles.themeColor}}>*</Text></Text>
                                        <View style={GlobalStyles.cellRight}>
                                            <TextInput
                                                placeholder={this.state.birthaddress ? this.state.birthaddress : '出生地(中文)，境外地址不填此项' }
                                                onChangeText={(text) => {
                                                    this.updateState({birthaddress: text})
                                                }}
                                                style={[GlobalStyles.cellInput, GlobalStyles.cellTextColor, GlobalStyles.isIOS ? null : styles.inputAndroid]} 
                                                underlineColorAndroid={'transparent'}
                                            >
                                            </TextInput>
                                        </View>
                                    </View>
                                    <View style={GlobalStyles.cellItem}>
                                        <Text style={GlobalStyles.cellLeft}>出生地<Text style={{color: GlobalStyles.themeColor}}>*</Text></Text>
                                        <View style={GlobalStyles.cellRight}>
                                            <TextInput
                                                placeholder={this.state.birthaddress_pinyin ? this.state.birthaddress_pinyin : '出生地(英文或拼音)' }
                                                onChangeText={(text) => {
                                                    this.updateState({birthaddress_pinyin: text})
                                                }}
                                                style={[GlobalStyles.cellInput, GlobalStyles.cellTextColor, GlobalStyles.isIOS ? null : styles.inputAndroid]} 
                                                underlineColorAndroid={'transparent'}
                                            >
                                            </TextInput>
                                        </View>
                                    </View>
                                    <View style={GlobalStyles.cellItem}>
                                        <Text style={[GlobalStyles.cellLeft, {width: 100}]}>税收居民国及纳税人识别号<Text style={{color: GlobalStyles.themeColor}}>*</Text></Text>
                                        <View style={GlobalStyles.cellRight}>
                                            <TextInput
                                                placeholder={this.state.recognition ? this.state.recognition : '税收居民国及纳税人识别号' }
                                                onChangeText={(text) => {
                                                    this.updateState({recognition: text})
                                                }}
                                                style={[GlobalStyles.cellInput, GlobalStyles.cellTextColor, GlobalStyles.isIOS ? null : styles.inputAndroid]} 
                                                underlineColorAndroid={'transparent'}
                                            >
                                            </TextInput>
                                        </View>
                                    </View>
                                </View>
                            </View>


                            <View style={[GlobalStyles.whiteModule, {marginTop: 0}]}>
                                <Text style={GlobalStyles.defaultText}>如不能提供居民国(地区)纳税人识别号，请选择原因</Text>
                                <View style={[GlobalStyles.mradio, {width: GlobalStyles.width - 30}]}>
                                    {this.state.reason == '1' ?
                                        <TouchableOpacity onPress={() => {this.setReason(1)}} style={[GlobalStyles.radioItem, GlobalStyles.flexRowStartStart]}>
                                            <View style={[GlobalStyles.radioLeft, {borderColor: GlobalStyles.themeColor, backgroundColor: GlobalStyles.themeColor}]}>
                                                <Image source={require('../../assets/images/icons/icon_gouxuan.png')} style={[GlobalStyles.gouxuanIco]} />
                                            </View>
                                            <Text style={GlobalStyles.radioRightThemeColor}>居民国(地区)不发放纳税人识别号</Text>
                                        </TouchableOpacity>
                                    :
                                        <TouchableOpacity onPress={() => {this.setReason(1)}} style={[GlobalStyles.radioItem, GlobalStyles.flexRowStartStart]}>
                                            <View style={[GlobalStyles.radioLeft, {borderColor: '#666', }]}></View>
                                            <Text style={GlobalStyles.radioRight}>居民国(地区)不发放纳税人识别号</Text>
                                        </TouchableOpacity>
                                    }
                                    {this.state.reason == 2 ?
                                        <TouchableOpacity onPress={() => {this.setReason(2)}} style={[GlobalStyles.radioItem, GlobalStyles.flexRowStartStart]}>
                                            <View style={[GlobalStyles.radioLeft, {borderColor: GlobalStyles.themeColor, backgroundColor: GlobalStyles.themeColor}]}>
                                                <Image source={require('../../assets/images/icons/icon_gouxuan.png')} style={[GlobalStyles.gouxuanIco]} />
                                            </View>
                                            <Text style={GlobalStyles.radioRightThemeColor}>账户持有人未能取得纳税人识别号</Text>
                                        </TouchableOpacity>
                                    :
                                        <TouchableOpacity onPress={() => {this.setReason(2)}} style={[GlobalStyles.radioItem, GlobalStyles.flexRowStartStart]}>
                                            <View style={[GlobalStyles.radioLeft, {borderColor: '#666', }]}></View>
                                            <Text style={GlobalStyles.radioRight}>账户持有人未能取得纳税人识别号(需要解释具体原因)</Text>
                                        </TouchableOpacity>
                                    }
                                </View>
                                {this.state.reason == 2 ?
                                    <View style={GlobalStyles.mcell}>
                                        <View style={GlobalStyles.cellItem}>
                                            <Text style={GlobalStyles.cellLeft}>具体原因</Text>
                                            <View style={GlobalStyles.cellRight}>
                                                <TextInput
                                                    placeholder={this.state.reason_describe ? this.state.reason_describe : '未能取得纳税人识别号的具体原因' }
                                                    onChangeText={(text) => {
                                                        this.updateState({reason_describe: text})
                                                    }}
                                                    style={[GlobalStyles.cellInput, GlobalStyles.cellTextColor, GlobalStyles.isIOS ? null : styles.inputAndroid]} 
                                                    underlineColorAndroid={'transparent'}
                                                >
                                                </TextInput>
                                            </View>
                                        </View>
                                    </View> 
                                : null }
                            </View>
                        </View> 
                    : null }

                    <View style={[GlobalStyles.whiteModule, {marginTop: 10}]}>
                        <TouchableOpacity onPress={()=>this.Subziliao()} style={[GlobalStyles.submit, {marginBottom: 15}]}>
                            <View style={GlobalStyles.btn}>
                                <Text style={GlobalStyles.btna}>提交</Text>   
                            </View>
                        </TouchableOpacity>
                    </View>
                </KeyboardAwareScrollView>
                <DateTimePicker
                    titleIOS={'选择时间'}
                    confirmTextIOS='确认'
                    cancelTextIOS='取消'
                    datePickerModeAndroid='calendar'
                    mode='date'
                    isVisible={this.state.isDateTimePickerVisible}
                    onConfirm={this._handleDatePicked}
                    onCancel={this._hideDateTimePicker}
                />
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: GlobalStyles.bgColor,
    },
    webContainer: {
        width: GlobalStyles.width,
        height: GlobalStyles.height,
        flex: 1,
        backgroundColor: '#fff',
        marginTop: Platform.OS === 'ios' ? -15 : 0,
    },
    cellRightText: {
        color: '#bbbbc1',
        fontSize: 14,
        left: GlobalStyles.isIOS ? 0 : 4,
    },
    botBar: {
        height: 54,
        backgroundColor: '#fff',
        display: 'flex',
        flexDirection: 'row',
        justifyContent: 'center',
        alignItems: 'center',
        borderTopColor: '#ececec',
        borderTopWidth: 1,

    },
    botLeft: {
        flex: 1,
        display: 'flex',
        flexDirection: 'column',
        justifyContent: 'center',
        alignItems: 'center'
    },
    botLeftIco: {
        height: 24,

    },
    botLeftText: {
        fontSize: 13,
        color: '#666',
        height: 20,
        lineHeight: 20,
    },
    botRight: {
        flex: 2.5,
        backgroundColor: GlobalStyles.themeColor,
        height: 54,
        justifyContent: 'center',
        alignItems: 'center',

    },
    botRightText: {
        color: '#fff',
        fontSize: 18,
        fontWeight: 'bold'
    },
    hetongico: {
        backgroundColor: 'transparent',
        position: 'absolute',
        bottom: 80,
        right: 15
    },
    fanhuidingbu: {
        backgroundColor: 'transparent',
        marginBottom: 10,
    },
    fanhuidingbuico: {
        backgroundColor: 'transparent',
        width: 40,
        height: 40,
    },
    yijiandaodi: {
        backgroundColor: 'transparent',

    },
    yijiandaodiico: {
        backgroundColor: 'transparent',
        width: 40,
        height: 40,
    },
});
